package cn.funnyxb.powerremember.uis.task.done.study;

import android.content.Intent;
import android.database.Cursor;
import cn.funnyxb.powerremember.beans.ATask;
import cn.funnyxb.powerremember.db.AllTableHolders;
import cn.funnyxb.powerremember.db.tables.Tbholder_studyLog;
import cn.funnyxb.powerremember.db.tables.Tbholder_taskWithWords;
import cn.funnyxb.powerremember.uis.task.done.InputIntentChecker;
import cn.funnyxb.tools.appFrame.App;
import cn.funnyxb.tools.appFrame.activityFrame.AbstractProccessor;
import cn.funnyxb.tools.appFrame.debugTool.Debuger;
import java.util.ArrayList;

public class Proccessor_Study extends AbstractProccessor
  implements IProccessor_Study
{
  private StudyConfiger config = null;
  private InputIntentChecker intentChecker;
  private String sqlFilter = "";
  private volatile Tbholder_taskWithWords tbHolder = null;
  private IUI_Study ui;

  public Proccessor_Study(IUI_Study paramIUI_Study)
  {
    this.ui = paramIUI_Study;
  }

  private boolean checkIntentDataIsValid(Intent paramIntent)
  {
    this.intentChecker = new InputIntentChecker(paramIntent);
    return this.intentChecker.checkInputIsValid();
  }

  private int computePageCntOfConfig()
  {
    return (int)Math.ceil((0.0D + this.tbHolder.queryCntInRange(this.intentChecker.getWordStart(), this.intentChecker.getWordEnd(), this.sqlFilter)) / this.config.getPageSize());
  }

  private void loadConfig()
  {
    this.config = StudyConfiger.getConfig(App.getApp());
  }

  private Cursor loadPageData(int paramInt)
  {
    log("loadpagedata,page=" + paramInt);
    if (paramInt < 1);
    int i;
    int j;
    for (Cursor localCursor = null; ; localCursor = this.tbHolder.queryAPart(this.intentChecker.getWordStart(), this.intentChecker.getWordEnd(), i, j, this.sqlFilter))
    {
      return localCursor;
      i = (paramInt - 1) * this.config.getPageSize();
      j = Math.min(this.config.getPageSize(), 1 + this.intentChecker.getWordEnd() - i);
    }
  }

  private void log(String paramString)
  {
    Debuger.log("proc_study", paramString);
  }

  private String makeDifficultySqlfilter(ArrayList<Integer> paramArrayList)
  {
    if ((paramArrayList == null) || (paramArrayList.size() == 0));
    String str2;
    for (String str1 = ""; ; str1 = " difficulty in ( " + str2.substring(1, str2.length() - 1) + " )")
    {
      return str1;
      str2 = paramArrayList.toString();
    }
  }

  public void asyncPrepare(Intent paramIntent)
  {
    new 1(this, paramIntent).execute(new Void[0]);
  }

  public void asyncPreparePage(int paramInt)
  {
    log("prepare page=" + paramInt);
    new 2(this, paramInt).execute(new Void[0]);
  }

  public void destroy()
  {
    super.releaseResource();
  }

  public void freashPageCnt()
  {
    int i = computePageCntOfConfig();
    this.ui.notifyPageCnt(i);
  }

  public ArrayList<Integer> getDifficultys()
  {
    if (this.config == null);
    for (ArrayList localArrayList = null; ; localArrayList = this.config.getDifficultys())
      return localArrayList;
  }

  public InputIntentChecker getInputData()
  {
    return this.intentChecker;
  }

  public void notifyDifficultySetChange(ArrayList<Integer> paramArrayList)
  {
    String str = makeDifficultySqlfilter(paramArrayList);
    log("difficultySqlFilter=" + str);
    this.config.setDifficultys(paramArrayList);
    if (this.sqlFilter.equals(str));
    while (true)
    {
      return;
      this.sqlFilter = str;
      asyncPreparePage(1);
      freashPageCnt();
    }
  }

  public void notifyStudyLog(long paramLong1, long paramLong2)
  {
    Tbholder_studyLog localTbholder_studyLog = App.getApp().getAllTableHolders().getTbholder_studyLog();
    if (localTbholder_studyLog == null);
    while (true)
    {
      return;
      localTbholder_studyLog.log(this.intentChecker.getTaskInfo().getId(), this.intentChecker.getGroupId(), this.intentChecker.getStudyTpye(), paramLong1, paramLong2);
    }
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.powerremember.uis.task.done.study.Proccessor_Study
 * JD-Core Version:    0.5.3
 */